package cn.cloud.all.security.oauth2.client.exception;

import cn.cloud.all.security.authentication.exception.InsufficientAuthenticationException;
import cn.cloud.all.security.oauth2.resource.OAuth2ProtectedResourceDetails;

@SuppressWarnings("serial")
public class AccessTokenRequiredException extends InsufficientAuthenticationException {

    private final OAuth2ProtectedResourceDetails resource;

    public AccessTokenRequiredException(OAuth2ProtectedResourceDetails resource) {
        super("OAuth2 access denied.");
        this.resource = resource;
    }

    public AccessTokenRequiredException(String msg, OAuth2ProtectedResourceDetails resource) {
        super(msg);
        this.resource = resource;
    }

    public AccessTokenRequiredException(String msg, OAuth2ProtectedResourceDetails resource, Throwable t) {
        super(msg, t);
        this.resource = resource;
    }

    public OAuth2ProtectedResourceDetails getResource() {
        return resource;
    }
}
